﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework5
{
    public class Customer
    {
        private string name;
        private string sex;
        private int age;
        private string tel;

        public Customer()
        {
        }

        public Customer(string name, string sex, int age, string tel)
        {
            this.name = name;
            this.sex = sex;
            this.age = age;
            this.tel = tel;
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        public string Sex
        {
            get { return sex; }
            set { sex = value; }
        }
        public int Age
        {
            get { return age; }
            set { age = value; }
        }
        public string Tel
        {
            get { return tel; }
            set { tel = value; }
        }

        public override bool Equals(object obj)
        {
            var customer = obj as Customer;
            return customer != null &&
                   name == customer.name &&
                   sex == customer.sex &&
                   age == customer.age &&
                   tel == customer.tel;
        }

        public override int GetHashCode()
        {
            var hashCode = 869902723;
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(name);
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(sex);
            hashCode = hashCode * -1521134295 + age.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(tel);
            return hashCode;
        }

        public override string ToString()
        {
            return $"顾客姓名：{name}，";
        }
    }
}
